home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 April
/
CMCD0404.ISO
/
Software
/
Shareware
/
Programare
/
sharp
/
wwwSharp_setup.exe
/
{app}
/
Examples
/
Data access
/
DataBindings (DataView)
/
index.hta
< prev
Wrap
Text File
|
2003-12-16
|
2KB
|
75 lines
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>www-Sharp.ClrHost DataView example</TITLE>
<META name="GENERATOR" content="MSHTML 6.00.2800.1264">
<META http-equiv="MSThemeCompatible" content="Yes">
<OBJECT id="myDSO" classid="clsid:E3BC8FCA-E3F4-4B98-8627-9D3D343F9DA0">
<PARAM name="AssemblyName"
value="System.Data, Version=1.0.5000.0, PublicKeyToken=b77a5c561934e089, Culture=neutral">
<PARAM name="DataAdapterTypeName" value="System.Data.SqlClient.SqlDataAdapter">
<PARAM name="ConnectionTypeName" value="System.Data.SqlClient.SqlConnection">
<PARAM name="ConnectionString" value="Integrated Security=SSPI;Database=Northwind;">
<PARAM name="CommandText" value="Select * from [Customers]">
<PARAM name="UseView" value="true">
<PARAM name="Filter" value="CustomerID < 'S'">
<PARAM name="Sort" value="ContactName">
<PARAM name="RowStateFilter" value="CurrentRows">
</OBJECT>
<STYLE>
TH
{
background-color: #99CC33;
}
TD
{
background-color: #00FF99;
}
BUTTON
{
width: 100px;
}
</STYLE>
<SCRIPT>
window.onload = Fill;
function Fill()
{
var i;
var str = "<TABLE id=\"tblCustomers\" dataSrc=\"#myDSO\" border=\"0\" width=\"100%\" dataPageSize=\"10\">\r\n";
var rs = myDSO.recordset;
if (rs == null)
{
window.alert("Recordset is not valid");
return;
}
str += "<THEAD>\r\n<TR>\r\n";
for (i = 0; i < rs.Fields.Count; i++)
str += "<TH>" + rs.Fields.Item(i).Name + "</TH>\r\n";
str += "</TR>\r\n</THEAD>\r\n";
str += "<TBODY>\r\n<TR>\r\n";
for (i = 0; i < rs.Fields.Count; i++)
str += "<TD><SPAN dataFld=\"" + rs.Fields.Item(i).Name + "\"></SPAN></TD>\r\n";
str += "</TR>\r\n</TBODY>\r\n";
str += "</TABLE>";
tblCustomers.outerHTML = str;
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON id="btnFirst" onclick="tblCustomers.firstPage()">< <</BUTTON>
<BUTTON id="btnPrev" onclick="tblCustomers.previousPage()"><</BUTTON>
<BUTTON id="btnNext" onclick="tblCustomers.nextPage()">></BUTTON>
<BUTTON id="btnLast" onclick="tblCustomers.lastPage()">> ></BUTTON>
<TABLE id="tblCustomers">
<TBODY></TBODY>
</TABLE>
</BODY>
</HTML>